package com.yifang.yibingproject.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifang.yibingproject.entity.SysRoleAuthEntity;
import com.yifang.yibingproject.mapper.SysRoleAuthMapper;
import com.yifang.yibingproject.service.SysRoleAuthService;
import org.springframework.stereotype.Service;

@Service
public class SysRoleAuthServiceImpl extends ServiceImpl<SysRoleAuthMapper, SysRoleAuthEntity> implements SysRoleAuthService {

    /**
     * 根据角色ID和用户ID删除角色用户关联
     * @param roleId
     * @return
     */
    @Override
    public String deleteRoleAuth(Long roleId) {
        if(roleId == null ||  roleId <=0 ){
            return "SUCCESS";
        }
        LambdaUpdateWrapper<SysRoleAuthEntity> updateWrapper = new LambdaUpdateWrapper();
        updateWrapper.eq(SysRoleAuthEntity::getRoleId,roleId);

        remove(updateWrapper);
        return "SUCCESS";
    }
}
